/** 
 * Project Name:Food_Sysrem 
 * File Name:Update_food_users.java 
 * Package Name:priv.web.control 
 * Date:2018年5月31日上午1:35:25 
 * Copyright (c) 2018, Fkuennh All Rights Reserved. 
 * 
*/  
  
package priv.web.control;  
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.alibaba.fastjson.JSON;

import priv.web.util.ReviewJDBCUtil;

public class Update_Food_users extends HttpServlet{
	private static final Logger logger = Logger.getLogger(Update_Food_users.class);

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		String sql = "update food_users set b_password=?,b_phone=?,b_email=? where b_id=?";
		try {
			int result = ReviewJDBCUtil.updateSal(sql,
					req.getParameter("b_password"),
					req.getParameter("b_phone"),
					req.getParameter("b_email"),
					req.getParameter("b_id")
					);
			Package package1;
			if(result==1){
				 package1 = new Package(1, "Success", null);
			}else {
				 package1 = new Package(0, "Failure", null);				
			}
			resp.getWriter().print(JSON.toJSONString(package1));
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			logger.error(e);
		} catch (SQLException e) {
			e.printStackTrace();
			logger.error(e);
		}
	}
	
	
}
